import java.util.*;


public class Solution {
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     * 
     * @param number long长整型 
     * @return long长整型
     */
    public long cutRope (long number) {
        // write code here

        if (number < 4) {
            return number - 1;
        }

        long res = 1;
        long num1 = number / 3;
        long num2 = number % 3;

        if (num2 == 1) {
            num1--;
            num2 = 4;
        }
        
        if (num2 != 0) {
            res *= num2;
        }

        long base = 3;
        while (0 < num1) {
            if (num1 % 2 == 0) {
                base = base * base % 998244353;
                num1 /= 2;
            }
            else {
                res = res * base % 998244353;
                num1--;
                base = base * base % 998244353;
                num1 /= 2;
            }
        }

        return res % 998244353;

    }
}